<!--
 * @Date: 2025-05-12 09:57:16
 * @LastEditors: Csir 2215995096@qq.com
 * @LastEditTime: 2025-05-12 10:38:04
 * @FilePath: \yujin-ui-admin\src\views\opticore\print\components\MaterialsTableList.vue
-->
<template>
  <!--表格-->
  
  <el-table
    v-loading="false"
    :data="dataList"
    :stripe="true"
    :show-overflow-tooltip="true"
    :border="true"
  >
    <el-table-column label="序列号" align="center" prop="serialNo" />
    <el-table-column label="工单号" align="center" prop="docNo" />
    <el-table-column label="物料编号" align="center" prop="itemCode" />
    <el-table-column label="物料名称" align="center" prop="itemName" />
    <el-table-column label="物料规格" align="center" prop="itemSpecification" />
    <el-table-column label="操作" align="center" min-width="120px">
      <template #default="scope">
        <el-button link type="primary" @click="printCode(scope.row)"> 打印 </el-button>
        <!-- <el-button link type="primary" @click="printContent"> 打印 </el-button> -->
      </template>
    </el-table-column>
  </el-table>
  <!-- 调用打印组件 -->
  <PrintQrCode
    :visible="printDialogVisible"
    :currentMaterialsItem="selectedMaterialsItem"
    @reset="resetState"
  />
</template>

<script setup lang="ts">
import PrintQrCode from '@/views/opticore/print/components/PrintQrCode.vue'

const props = defineProps({
  dataList: Array,
  default: () => []
})



const printDialogVisible = ref(false)
const selectedMaterialsItem = ref<any>({})
/** 打印方法 */
const printCode = (item: any) => {
  console.log(item)
  selectedMaterialsItem.value = item
  printDialogVisible.value = true
}

function resetState() {
  printDialogVisible.value = false
  console.log(printDialogVisible.value)
}
</script>
